package practice;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int num=scanner.nextInt();

        while(num>0){
            int N=scanner.nextInt();
            int S=scanner.nextInt();
            int length=N+1,sum=0,tmp=0;
            int []arr=new int[N];
            for (int i = 0; i < N; i++) {
                arr[i]=scanner.nextInt();
            }
            for (int j = 0; j < N; j++) {
                sum+=arr[j];
                while(sum>=S){
                  length=Math.min(length,j-tmp+1);
                  tmp++;
                  sum-=arr[tmp-1];
                }
            }
            if(length>N)
                length=0;
            System.out.println(length);
        }
    }
}
